//
//  radioDetailView.m
//  iNews
//
//  Created by lanou3g on 14-12-4.
//  Copyright (c) 2014年 张在青. All rights reserved.
//

#import "radioDetailView.h"
#import "radioDetailDataModel.h"
#import "RadioHandel.h"
@implementation radioDetailView

-(void)dealloc
{
    [_imv release];
    [_slider release];
    [_starButton release];
    [_leftButton release];
    [_rightLabel release];
    [_getButton release];
    [_shareButton release];
    [super dealloc];
    
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:1.000 green:0.905 blue:0.544 alpha:0.500];
        
        [self addAllViews];
        
    }
    return self;
}


-(void)addAllViews
{
   //图片
    
    UIImageView *backima = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height*.8)] autorelease];
    //backima.image = [UIImage imageNamed:@"backIM.jpg"];
    backima.image = [UIImage imageNamed:@"back.png"];
    [self addSubview:backima];
    
    self.imv= [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width/3*2, self.bounds.size.height/2-30)] autorelease];
    self.imv.image = [UIImage imageNamed:@"contentview_listen@3x.png"];
    self.imv.layer.cornerRadius = 105;
    self.imv.clipsToBounds = YES;
    self.imv.layer.borderWidth = 15;
    self.imv.layer.borderColor = [UIColor colorWithRed:0.667 green:0.659 blue:0.676 alpha:0.7].CGColor;
//    self.imv.layer.shouldRasterize = 20;
//    self.imv.layer.shadowColor = [UIColor clearColor].CGColor ;
//    self.imv.layer.shadowOffset = CGSizeMake(20, 10);
//    self.imv.layer.shadowOpacity = 100;
    
 
    
    self.imv.center = backima.center;
    [backima addSubview:self.imv];

    //调转按钮,带回到主页面
    self.leftButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.leftButton.tag = 101;
    self.leftButton.frame = CGRectMake(20, 20, 30, 20);
    self.leftButton.layer.cornerRadius = 15;
    
    [self.leftButton setBackgroundImage:[UIImage imageNamed:@"fanhui.png"] forState:UIControlStateNormal];
    [self addSubview:self.leftButton];
    
    
    self.rightLabel = [[[UILabel alloc] initWithFrame:CGRectMake(backima.bounds.size.width-40,20 , 40, 30)] autorelease];
    //self.rightLabel.backgroundColor = [UIColor redColor];
    self.rightLabel.textColor = [UIColor whiteColor];
    self.rightLabel.font = [UIFont systemFontOfSize:14];
   
    [self addSubview: self.rightLabel];
    //控制播放进程
    self.slider = [[[UISlider alloc] initWithFrame:CGRectMake(CGRectGetMinX(backima.frame), CGRectGetMaxY(backima.frame)-4.8, CGRectGetWidth(backima.frame), 10)] autorelease];
    //[self.slider setThumbImage:[UIImage imageNamed:@"UMS_url_music.jpg"] forState:UIControlStateNormal];
    self.slider.thumbTintColor = [UIColor colorWithWhite:0.809 alpha:1.000];
    self.slider.minimumTrackTintColor = [UIColor colorWithRed:0.397 green:0.413 blue:0.467 alpha:1.000];
    //[self.slider setThumbImage:[UIImage imageNamed:@"huadong.png"] forState:UIControlStateNormal];
    [self addSubview: self.slider];
    
    //显示标题
    self.titleLab = [[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(backima.frame)+10, CGRectGetMaxY(backima.frame)-40,backima.frame.size.width *0.95, 30)] autorelease];
    //self.titleLab.backgroundColor = [UIColor redColor];
    self.titleLab.text = @"title";
    self.titleLab.font = [UIFont systemFontOfSize:15];
    self.titleLab.textColor = [UIColor whiteColor];
    [self addSubview: self.titleLab];
    
    
    //开始按钮,用来控制电台播放
    self.starButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.starButton.frame = CGRectMake(CGRectGetMinX(self.slider.frame)+130, CGRectGetMaxY(self.slider.frame)+10, 70, 70);
    //self.starButton.backgroundColor = [UIColor redColor];
    self.starButton.layer.cornerRadius = 35;
   // [self.starButton  setTitle:@"  " forState:UIControlStateNormal];
    [self.starButton setBackgroundImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
    [self addSubview:self.starButton];
   
    
    self.getButton = [[[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.starButton.frame)+45, CGRectGetMinY(self.starButton.frame)+7, CGRectGetWidth(self.starButton.frame)-20,  CGRectGetHeight(self.starButton.frame)-20)] autorelease];
    //[self.getButton setTitle:@"/" forState:UIControlStateNormal];
    [self.getButton setImage:[UIImage imageNamed:@"laodDown.png"] forState:UIControlStateNormal];
   // self.getButton.backgroundColor = [UIColor grayColor];
    [self addSubview:self.getButton];
    
    
    self.shareButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.starButton.frame)-100, CGRectGetMinY(self.starButton.frame)+10,CGRectGetWidth(self.starButton.frame)-20,  CGRectGetHeight(self.starButton.frame)-20)];
    //[self.shareButton setTitle:@"分享" forState:UIControlStateNormal ];
    [self.shareButton setImage:[UIImage imageNamed:@"shar.png"] forState:UIControlStateNormal];
    //self.shareButton.backgroundColor = [UIColor grayColor];
    [self addSubview:self.shareButton];
    
}
@end
